<?php

/**
 * This is the model class for table "tbl_qb_paymentsapplied".
 *
 * The followings are the available columns in table 'tbl_qb_paymentsapplied':
 * @property string $date
 * @property string $customerRefListID
 * @property string $customerRefFullName
 * @property string $totalAmount
 * @property string $paymentMethodRefFullName
 * @property string $refNumber
 * @property string $memo
 * @property string $unusedPayment
 * @property string $unusedCredits
 * @property string $invoiceTaxnID
 * @property string $invoiceNo
 * @property string $invoiceDate
 * @property string $invoiceAmount
 * @property string $invoiceBalance
 * @property string $paymentTxnID
 */
class QbPaymentsapplied extends CActiveRecord
{
	/**
	 * Returns the static model of the specified AR class.
	 * @return QbPaymentsapplied the static model class
	 */
	public static function model($className=__CLASS__)
	{
		return parent::model($className);
	}

	/**
	 * @return string the associated database table name
	 */
	public function tableName()
	{
		return 'tbl_qb_paymentsapplied';
	}

	/**
	 * @return array validation rules for model attributes.
	 */
	public function rules()
	{
		// NOTE: you should only define rules for those attributes that
		// will receive user inputs.
		return array(
			array('date, unusedCredits', 'length', 'max'=>9),
			array('customerRefListID', 'length', 'max'=>19),
			array('customerRefFullName', 'length', 'max'=>49),
			array('totalAmount, unusedPayment, invoiceAmount', 'length', 'max'=>15),
			array('paymentMethodRefFullName', 'length', 'max'=>5),
			array('refNumber', 'length', 'max'=>20),
			array('memo', 'length', 'max'=>194),
			array('invoiceTaxnID, paymentTxnID', 'length', 'max'=>25),
			array('invoiceNo', 'length', 'max'=>11),
			array('invoiceDate', 'length', 'max'=>10),
			array('invoiceBalance', 'length', 'max'=>7),
			// The following rule is used by search().
			// Please remove those attributes that should not be searched.
			array('date, customerRefListID, customerRefFullName, totalAmount, paymentMethodRefFullName, refNumber, memo, unusedPayment, unusedCredits, invoiceTaxnID, invoiceNo, invoiceDate, invoiceAmount, invoiceBalance, paymentTxnID', 'safe', 'on'=>'search'),
		);
	}

	/**
	 * @return array relational rules.
	 */
	public function relations()
	{
		// NOTE: you may need to adjust the relation name and the related
		// class name for the relations automatically generated below.
		return array(
		);
	}

	/**
	 * @return array customized attribute labels (name=>label)
	 */
	public function attributeLabels()
	{
		return array(
			'date' => 'Date',
			'customerRefListID' => 'Customer Ref List',
			'customerRefFullName' => 'Customer Ref Full Name',
			'totalAmount' => 'Total Amount',
			'paymentMethodRefFullName' => 'Payment Method Ref Full Name',
			'refNumber' => 'Ref Number',
			'memo' => 'Memo',
			'unusedPayment' => 'Unused Payment',
			'unusedCredits' => 'Unused Credits',
			'invoiceTaxnID' => 'Invoice Taxn',
			'invoiceNo' => 'Invoice No',
			'invoiceDate' => 'Invoice Date',
			'invoiceAmount' => 'Invoice Amount',
			'invoiceBalance' => 'Invoice Balance',
			'paymentTxnID' => 'Payment Txn',
		);
	}

	/**
	 * Retrieves a list of models based on the current search/filter conditions.
	 * @return CActiveDataProvider the data provider that can return the models based on the search/filter conditions.
	 */
	public function search()
	{
		// Warning: Please modify the following code to remove attributes that
		// should not be searched.

		$criteria=new CDbCriteria;

		$criteria->compare('date',$this->date,true);
		$criteria->compare('customerRefListID',$this->customerRefListID,true);
		$criteria->compare('customerRefFullName',$this->customerRefFullName,true);
		$criteria->compare('totalAmount',$this->totalAmount,true);
		$criteria->compare('paymentMethodRefFullName',$this->paymentMethodRefFullName,true);
		$criteria->compare('refNumber',$this->refNumber,true);
		$criteria->compare('memo',$this->memo,true);
		$criteria->compare('unusedPayment',$this->unusedPayment,true);
		$criteria->compare('unusedCredits',$this->unusedCredits,true);
		$criteria->compare('invoiceTaxnID',$this->invoiceTaxnID,true);
		$criteria->compare('invoiceNo',$this->invoiceNo,true);
		$criteria->compare('invoiceDate',$this->invoiceDate,true);
		$criteria->compare('invoiceAmount',$this->invoiceAmount,true);
		$criteria->compare('invoiceBalance',$this->invoiceBalance,true);
		$criteria->compare('paymentTxnID',$this->paymentTxnID,true);

		return new CActiveDataProvider($this, array(
			'criteria'=>$criteria,
		));
	}
}